<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ShareB.Models.NewPublicationModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	CreatePublication
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>CreatePublication</h2>

    <% using (Html.BeginForm()) {%>
        <%: Html.ValidationSummary(true) %>

        <fieldset>
            <legend>Fields</legend>

            <table>
           
            <!-- Informação a preservar para o nosso modelo -->
            <%: Html.HiddenFor(model => model.UserID) %>
            <%: Html.HiddenFor(model => model.Username)%>
            <%: Html.HiddenFor(model => model.PubConfID)%>
            <%: Html.HiddenFor(model => model.StartDate)%>
            
            
            <tr>
                <td>
                <%: Html.LabelFor(model => model.Tittle) %> Publication:
                </td>
                <td colspan = "5">
                <%: Html.TextBoxFor(model => model.Tittle) %>
                <%: Html.ValidationMessageFor(model => model.Tittle) %>
                </td>
            </tr>
            
            
            <% for (int i = 0; i < Model.configuration.fieldsConf.Count; i++)
               { %>
                    <tr>
                        <td>
                        <%: Html.DisplayFor(model => model.configuration.fieldsConf[i].FieldName) %> : <!-- BRUTE FORCE SOLUTION -->
                        </td>
                        <td colspan = "5">
                        <%: Html.TextBoxFor(model => model.Fields[i].FieldValue) %>                        
                        </td>
                    </tr>
                    <!-- Hidden fields to preserve information -->
                    <%: Html.HiddenFor(model => model.configuration.fieldsConf[i].FieldName)%>
                    <%: Html.HiddenFor(model => model.configuration.fieldsConf[i].FieldType)%>
                    <%: Html.HiddenFor(model => model.configuration.fieldsConf[i].MetaFieldID)%>
                    <%: Html.HiddenFor(model => model.Fields[i].FieldName)%>
                    <%: Html.HiddenFor(model => model.Fields[i].MetaFieldID)%>
            <% } %>

             <tr>
                <td>
                <%: Html.Label("Your pontuation:") %>
                </td>
                <td>
                <%=Html.RadioButtonFor(model => model.ClassifAlone.Classification, "1")%><label>1</label>
                </td>
                <td>
                <%=Html.RadioButtonFor(model => model.ClassifAlone.Classification, "2")%><label>2</label>
                </td>
                <td>
                <%=Html.RadioButtonFor(model => model.ClassifAlone.Classification, "3")%><label>3</label>
                </td>
                <td>
                <%=Html.RadioButtonFor(model => model.ClassifAlone.Classification, "4")%><label>4</label>
                </td>
                <td>
                <%=Html.RadioButtonFor(model => model.ClassifAlone.Classification, "5")%><label>5</label>
                </td>
             </tr>

                <%: Html.ValidationMessageFor(model => model.ClassifAlone.Classification)%>

            </table>
            <p></p>
            <input type="submit" value="Create" />
        </fieldset>

    <% } %>

    <div>
        <%: Html.ActionLink("Back to List", "ChoiceConfiguration", "Publication")%>
    </div>

</asp:Content>
